package shiqi.controller;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import shiqi.pojo.User;

@RestController //声明Rest风格的控制器
//@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class}) //自动配置，相当于写了spring的配置文件
@RequestMapping("user")
public class UserController {

    @RequestMapping("{id}")
    @ResponseBody
    public User userInfo(@PathVariable() Integer id) {
        User user = new User("shiqi","a123456");
        user.setId(id);
        return user;
    }

    @RequestMapping("testException")
    public String exception() {
        int i = 1/0;
        return "success";
    }

   /* public static void main(String[] args) {
        //启动springboot的项目
        SpringApplication.run(UserController.class, args);
    }*/
}
